package com.financing.platform.service.impl;

import java.sql.SQLException;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.financing.platform.dao.IDiscussDao;
import com.financing.platform.dto.DiscussDTO;
import com.financing.platform.service.IDiscussService;

/**
 * 
* @ClassName: OrderServiceImpl 
* @Description: 系统功能开关
* @author chenming 
* @date 2014年8月18日 下午2:42:30 
*
 */
@Service("discussServiceImpl")
@Transactional
public class DiscussServiceImpl extends BaseServiceImpl implements IDiscussService {

	@Autowired
	IDiscussDao discussDaoImpl;

	public List<DiscussDTO> discussList(DiscussDTO discussDTO) {
		return discussDaoImpl.queryDiscussList(discussDTO);
	}

	public int updateDiscuss(String[] discussId,DiscussDTO discussDTO) throws SQLException {
		
		for(String id : discussId){
			discussDTO.setId(Integer.valueOf(id));
			discussDaoImpl.updateDiscussStatus(discussDTO);
		}
		
		log.info(new StringBuffer()
					.append("Update discuss status to ")
					.append(discussDTO.getStatus())
					.append("total:")
					.append(discussId.length)
					.append("rows").toString());
		return discussId.length;
	}
	
}
